<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html >
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showMachines.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="res/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/style.css">
    <script type="text/javascript" src="res/js/jquery-1.9.1.min.js"></script>

  </head>
  
  <body>
   <%@include file="../../template/header.jsp" %>
    
    <div class="subHead">
        <div class="container">
            <h1>商家管理后台</h1>
            <p class="lead">商家可以在此修改商品，修改商品类别，添加子店铺账户（总店管理员）等。</p>
        </div>
    </div>
    
    <div class="row mainContent">
        
        <%@include file="../../template/shopNav.jsp" %>
        
        <div class="span9">
        	<legend class="text-warning">商品类别</legend>
        	<table class="table table-striped table-hover">
                <thead>
	                <tr>
	                    <th>#</th>
	                    <th>机器名称</th>
	                    <th>状态</th>
	                    <th>1元</th>
	                    <th>5元</th>
	                    <th>10元</th>
	                    <th>20元</th>
	                    <th>50元</th>
	                    <th>现金余额</th>
	                    <th>电子余额</th>
	                    <th>暂停/启动</th>
	                </tr>
                </thead>
                <tbody>
               		<s:iterator value="#request.machines" id="machine" status="statu">
               			<tr>
               				<td><s:property value="#statu.index + 1" /></td>
               				<td><s:property value="#machine.name" /></td>
               				<td><s:property value="#machine.state" /></td>
               				<td><s:property value="#machine.oneYuanNum" /></td>
               				<td><s:property value="#machine.fiveYuanNum" /></td>
               				<td><s:property value="#machine.tenYuanNum" /></td>
               				<td><s:property value="#machine.twentyYuanNum" /></td>
               				<td><s:property value="#machine.fiftyYuanNum" /></td>
               				<td><s:property value="#machine.balance" /></td>
               				<td><s:property value="#machine.elecBlance" /></td>
               				<td>
               					<s:if test="#machine.state == 0">
               						<a href="#" class="btn btn-mini">暂停</a>
               					</s:if>
               					<s:else>
               						<a href="#" class="btn btn-mini">启动</a>
               					</s:else>
               				</td>
               			</tr>
               		</s:iterator>
                </tbody>
             </table>
        </div>
    </div>
    
    <div class="footer">
        <p>版权所有： 银盒子计划团队</p>
    </div>

    <script type="text/javascript" src="res/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $('a[name=delete]').each(function(){
            var that = $(this);
            that.on('click', function(){
                if(confirm('确定删除此商品？')){
                    return;
                }
                else {
                    return false;
                }
            });
        });
        
        $('li[name=templateHeader]').each(function(){
    	var that = $(this);
    	that.removeClass("active");
    
	    });
		$("#templateHeader2").addClass("active"); 
		
		$('li[name=shopNav]').each(function(){
	        	var that = $(this);
	        	that.removeClass("active");
	    });
	    $("#shopNav8").addClass("active");  
    </script>
  </body>
</html>
